FIND_PACKAGE(PkgConfig REQUIRED) 
#查找OpenCV依赖
MESSAGE(STATUS "----FIND OpenCV----")
include(${CMAKE_CURRENT_SOURCE_DIR}/depends/opencv/OpenCVWrapperConfig.cmake)
FIND_PACKAGE(OpenCV REQUIRED) 
IF(OpenCV_FOUND)
	MESSAGE(STATUS "--OpenCV Version: ${OpenCV_VERSION}")
	MESSAGE(STATUS "--OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
	MESSAGE(STATUS "--OpenCV_LIBS: ${OpenCV_LIBS}")
ELSE()
	IF (PkgConfig_FOUND)
		PKG_SEARCH_MODULE(OpenCV REQUIRED IMPORTED_TARGET)
		IF(TARGET PkgConfig::OpenCV)
			PKG_CHECK_MODULES(OpenCV REQUIRED)
			MESSAGE(STATUS "--OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
			SET(OpenCV_LIBS ${OpenCV_LIBRARIES})
			MESSAGE(STATUS "--OpenCV_LIBS: ${OpenCV_LIBS}")
		ENDIF(TARGET PkgConfig::OpenCV)
	ENDIF (PkgConfig_FOUND)
ENDIF(OpenCV_FOUND)

IF (OCR_OUTPUT_JNI)
#查找JNI依赖
	MESSAGE(STATUS "----FIND JavaRuntime----")
    FIND_PACKAGE(JNI REQUIRED)
    if (JNI_FOUND)
        MESSAGE(STATUS "--JNI_INCLUDE_DIRS: ${JNI_INCLUDE_DIRS}")
		SET(JNI_LIBS ${JNI_LIBRARIES})
        MESSAGE(STATUS "--JNI_LIBS: ${JNI_LIBS}")
        include_directories(${JNI_INCLUDE_DIRS})
    ELSE()
        MESSAGE(FATAL_ERROR "JNI Not Found!")
    ENDIF(JNI_FOUND)
ENDIF(OCR_OUTPUT_JNI)

IF (ENGINE_ONNX)
#查找OnnxRuntime依赖
	MESSAGE(STATUS "----FIND OnnxRuntime----")
	INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/depends/onnx/OnnxRuntimeWrapperConfig.cmake)
	FIND_PACKAGE(OnnxRuntime REQUIRED)
	IF (OnnxRuntime_FOUND)
		MESSAGE(STATUS "--OnnxRuntime_INCLUDE_DIRS: ${OnnxRuntime_INCLUDE_DIRS}")
		MESSAGE(STATUS "--OnnxRuntime_LIBS: ${OnnxRuntime_LIBS}")
	ELSE()
		IF (PkgConfig_FOUND)
			PKG_SEARCH_MODULE(OnnxRuntime REQUIRED libonnxruntime IMPORTED_TARGET)
			IF(TARGET PkgConfig::OnnxRuntime)
				PKG_CHECK_MODULES(OnnxRuntime REQUIRED libonnxruntime)
				MESSAGE(STATUS "--OnnxRuntime_INCLUDE_DIRS: ${OnnxRuntime_INCLUDE_DIRS}")
				SET(OnnxRuntime_LIBS ${OnnxRuntime_LIBRARIES})
				MESSAGE(STATUS "--OnnxRuntime_LIBS: ${OnnxRuntime_LIBS}")
			ENDIF(TARGET PkgConfig::OnnxRuntime)
		ENDIF (PkgConfig_FOUND)
	ENDIF(OnnxRuntime_FOUND)
ENDIF(ENGINE_ONNX)


IF (ENGINE_NCNN)
#查找NCNN依赖
	MESSAGE(STATUS "----FIND NCNN----")
	INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/depends/ncnn/NcnnWrapperConfig.cmake)
	FIND_PACKAGE(ncnn REQUIRED)
	IF (ncnn_FOUND)
		MESSAGE(STATUS "NCNN_INCLUDE_DIRS: ${NCNN_INCLUDE_DIRS}")
		#ncnn的cmake没有提供ncnn_LIBS参数,手动设置一下
		SET(ncnn_LIBS ncnn)
		MESSAGE(STATUS "ncnn_LIBS: ${ncnn_LIBS}")
	ELSE()
		IF (PkgConfig_FOUND)
			MESSAGE(STATUS "--PkgConfig is found")
			PKG_SEARCH_MODULE(ncnn REQUIRED libncnn IMPORTED_TARGET)
			IF(TARGET PkgConfig::ncnn)
				PKG_CHECK_MODULES(ncnn REQUIRED libncnn)
				MESSAGE(STATUS "--NCNN_INCLUDE_DIRS: ${NCNN_INCLUDE_DIRS}")
				#ncnn的cmake没有提供ncnn_LIBS参数,手动设置一下
				SET(ncnn_LIBS ncnn)
				MESSAGE(STATUS "ncnn_LIBS: ${ncnn_LIBS}")
			ENDIF(TARGET PkgConfig::ncnn)
		ENDIF (PkgConfig_FOUND)
	ENDIF(ncnn_FOUND)
ENDIF(ENGINE_NCNN)
	
